package io.kiki.sba.registry.server.clientInterface.remoting.handler;

import io.kiki.sba.registry.api.Channel;
import io.kiki.sba.registry.core.model.SyncConfigRequest;
import io.kiki.sba.registry.core.model.SyncConfigResponse;
import io.kiki.sba.registry.server.clientInterface.strategy.SyncConfigHandlerStrategy;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.Executor;


public class SyncConfigHandler extends AbstractClientDataRequestHandler<SyncConfigRequest> {
    @Autowired
    SyncConfigHandlerStrategy syncConfigHandlerStrategy;

    @Override
    public Object doHandle(Channel channel, SyncConfigRequest request) {
        SyncConfigResponse response = new SyncConfigResponse();
        response.setSuccess(true);
        syncConfigHandlerStrategy.handleSyncConfigResponse(response);
        return response;
    }

    @Override
    public Class interest() {
        return SyncConfigRequest.class;
    }

    @Override
    public Executor getExecutor() {
        return executorManager.getAccessSubExecutor();
    }
}
